package com.xiaoshuidi.cloud.module.member.controller.admin.coupon.vo;

import com.xiaoshuidi.cloud.framework.common.pojo.PageParam;
import com.xiaoshuidi.cloud.module.iot.uitils.DateformatUtils;
import com.xiaoshuidi.cloud.module.member.utils.DateUtils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;

/**
 * @author Ivan.Wu
 * @date 2023/3/21 15:17
 */
@Data
public class CouponRecordForm extends PageParam {

    @Schema(description = "发券人")
    private String issuerName;

    @Schema(description = "发放账户")
    private String issuerAccount;

    @Schema(description = "发券开始时间")
    private Date startTime;

    @Schema(description = "发券结束时间")
    private Date endTime;

    public Date getStartTime() {
        if (startTime != null) {
            return DateUtils.parse(DateformatUtils.formatDate(startTime, "yyyy-MM-dd").concat(" 00:00:00"), DateUtils.DATE_TIME_PATTERN);
        }
        return null;
    }

    public Date getEndTime() {
        if (endTime != null) {
            return DateUtils.parse(DateformatUtils.formatDate(endTime, "yyyy-MM-dd").concat(" 23:59:59"), DateUtils.DATE_TIME_PATTERN);
        }
        return null;
    }

}
